home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / Options.h < prev    next >
C/C++ Source or Header  |  2011-11-06  |  3KB  |  89 lines

  1. // FileZilla Server - a Windows ftp server
  2.  
  3. // Copyright (C) 2002-2004 - Tim Kosse <tim.kosse@gmx.de>
  4.  
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. #if !defined(AFX_OPTIONS_H__3E60F2D3_99F3_4271_92A3_2CF71AF62731__INCLUDED_)
  20. #define AFX_OPTIONS_H__3E60F2D3_99F3_4271_92A3_2CF71AF62731__INCLUDED_
  21.  
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25.  
  26. #include "OptionTypes.h"
  27. #include "SpeedLimit.h"
  28.  
  29. #include <list>
  30.  
  31. class TiXmlElement;
  32. class COptionsHelperWindow;
  33. class COptions
  34. {
  35.     friend COptionsHelperWindow;
  36.  
  37. public:
  38.     BOOL GetAsCommand(char **pBuffer, DWORD *nBufferLength);
  39.     CStdString GetOption(int nOptionID);
  40.     _int64 GetOptionVal(int nOptionID);
  41.  
  42.     COptions();
  43.     virtual ~COptions();
  44.  
  45.     static TiXmlElement *GetXML();
  46.     static BOOL FreeXML(TiXmlElement *pXML, bool save);
  47.  
  48.     BOOL ParseOptionsCommand(unsigned char *pData, DWORD dwDataLength, BOOL bFromLocal = FALSE);
  49.     void SetOption(int nOptionID, LPCTSTR value, bool save = true);
  50.     void SetOption(int nOptionID, _int64 value, bool save = true);
  51.     int GetCurrentSpeedLimit(int nMode);
  52.     void ReloadConfig();
  53.  
  54. protected:
  55.  
  56.     static CCriticalSectionWrapper m_Sync;
  57.     static std::list<COptions *> m_InstanceList;
  58.     static bool IsNumeric(LPCTSTR str);
  59.  
  60.     void SaveOptions();
  61.  
  62.     BOOL ReadSpeedLimits(TiXmlElement *pXML);
  63.     BOOL SaveSpeedLimits(TiXmlElement* pSettings);
  64.  
  65.     static SPEEDLIMITSLIST m_sSpeedLimits[2];
  66.     SPEEDLIMITSLIST m_SpeedLimits[2];
  67.  
  68.     struct t_OptionsCache
  69.     {
  70.         BOOL bCached;
  71.         int nType;
  72.         CStdString str;
  73.         _int64 value;
  74.     } m_OptionsCache[OPTIONS_NUM];
  75.     static t_OptionsCache m_sOptionsCache[OPTIONS_NUM];
  76.  
  77.     void Init();
  78.     static BOOL m_bInitialized;
  79.  
  80.     static void UpdateInstances();
  81.     COptionsHelperWindow *m_pOptionsHelperWindow;
  82. };
  83.  
  84.  
  85. //{{AFX_INSERT_LOCATION}}
  86. // Microsoft Visual C++ fⁿgt unmittelbar vor der vorhergehenden Zeile zusΣtzliche Deklarationen ein.
  87.  
  88. #endif // AFX_OPTIONS_H__3E60F2D3_99F3_4271_92A3_2CF71AF62731__INCLUDED_
  89.